package com.weigj.model;

import java.util.List;

import com.jfinal.plugin.activerecord.Model;

public class Dept extends Model<Dept>{
	public static final Dept deptDao = new Dept();
	/***
	 * 查询城市下的微公交运营部下的部门所在的区
	 * @param cityName
	 * @return
	 */
	public List<Dept> queryDeptByCityName(String  cityName){
		String sql="select tname from app_cardept c where c.cityname=? and fenname=? and enable=1 group by tname";
		List<Dept> list=deptDao.find(sql, cityName,"微公交运营部");
		return list;
	}
	
	/**
	 * 根据区域名称查询下的站点
	 * @return
	 */
	public List<Dept> queryDeptByTname(String tName){
		String sql="select * from app_cardept c where c.tname=? and c.fenname='微公交运营部'";
		return deptDao.find(sql, tName);
	}
	public Dept queryDeptByDeptName(String deptName){
		Dept d = new Dept();
		String sql = "select * from app_cardept d where d.deptname =?";
		d=deptDao.findFirst(sql,deptName);
		return d;
	}
}
